Skip to content

Repair missing Effect modules after desktop packaging#4160

Draft
juliusmarminge wants to merge 3 commits into
mainfrom
t3code/fix-bundling-issue-4154
Draft

Repair missing Effect modules after desktop packaging#4160
juliusmarminge wants to merge 3 commits into
mainfrom
t3code/fix-bundling-issue-4154

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jul 19, 2026

Copy link
Copy Markdown
Member

May fix #4154, but couldnt reproduce reliably

Summary

  • Add an electron-builder afterPack hook for desktop artifacts.
  • Restore and verify the required Effect runtime modules in app.asar.unpacked.
  • Add focused tests covering module repair and build configuration wiring.

Testing

  • Added desktop-after-pack.test.ts coverage for replacing stale unpacked payloads.
  • Updated build-desktop-artifact.test.ts to verify the after-pack hook configuration.

Note

Low Risk
Build-time packaging verification only; no runtime auth or data-path changes, though a stricter check could fail CI if unpack layout regresses.

Overview
Adds an electron-builder afterPack hook so desktop packaging fails fast if required runtime files are missing from app.asar.unpacked/node_modules (e.g. effect, @effect/platform-node, mime, undici).

desktop-after-pack.ts exports verifyUnpackedRuntimeFiles and an afterPack entry that checks a fixed list of paths under the packaged app output. build-desktop-artifact.ts copies the hook into the stage workspace, passes its path into createBuildConfig via optional afterPackHookPath, and sets build.afterPack when provided. Tests cover the verifier and Windows build config wiring (DESKTOP_AFTER_PACK_HOOK_FILE).

Reviewed by Cursor Bugbot for commit 301d19d. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add afterPack hook to verify required Effect modules are present after desktop packaging

  • Introduces desktop-after-pack.ts as an electron-builder afterPack hook that checks for required files in app.asar.unpacked/node_modules after packaging, throwing an error listing any missing files.
  • Updates buildDesktopArtifact in build-desktop-artifact.ts to stage the hook file into the app directory and pass its path to createBuildConfig, which now conditionally sets afterPack in the electron-builder config.
  • Risk: packaging will now fail if any required unpacked runtime files are absent, which is a new hard failure for previously silent omissions.
📊 Macroscope summarized 301d19d. 1 file reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 078c4995-dd34-4a54-a884-05d27dba891b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/fix-bundling-issue-4154

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Jul 19, 2026
Comment thread scripts/desktop-after-pack.ts Outdated
"resources",
"app.asar.unpacked",
"node_modules",
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong unpack path on macOS

High Severity

The repairUnpackedEffectModules function incorrectly assumes a fixed unpacked module path (appOutDir/resources/app.asar.unpacked). On macOS, the actual unpacked resources are located under Contents/Resources within the .app bundle. This mismatch causes the module repair to write to the wrong location, failing to update modules for macOS builds.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7c7f4b4. Configure here.

@macroscopeapp

macroscopeapp Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

An unresolved high-severity comment identifies that the unpacked resource path logic may be incorrect for macOS builds, where the path structure differs from Windows/Linux. This potential bug in the new verification hook warrants human review.

You can customize Macroscope's approvability policy. Learn more.

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Jul 19, 2026
@juliusmarminge
juliusmarminge marked this pull request as draft July 20, 2026 11:34
juliusmarminge and others added 3 commits July 20, 2026 17:42
- Add an electron-builder afterPack hook to restore the Effect runtime closure
- Add focused tests for hook behavior and build configuration
- Replace module repair with explicit payload verification
- Add coverage for complete and missing unpacked runtime files
Resolve app.asar.unpacked under the product app bundle on darwin while retaining the resources directory layout used by Windows and Linux.

Co-authored-by: codex <codex@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nightly 0.0.29-nightly.20260719.849 won't launch on Windows: effect missing from app.asar.unpacked (ERR_MODULE_NOT_FOUND Context)

1 participant